
{{extend('./layout.html')}


{{#block("body")}}

   
<div calss="main-container">
	

<div class="padding-md">
	

	<ul class="breadcrumb">
		
      <li>
        <span calss="primary-font"><i class="icon-home"></i></span>
        <a href="">Home</a>
      </li>
      <li>班级列表</li>

	</ul>

	<table class="tabel table-striped" id="dataTable">
		

		<thead>
			
			<tr>
				<th>班级ID</th>
				<th>班级名称</th>
				<th>时间</th>
				<th>操作</th>
				
			</tr>
              
              {{#each(array)}}
               

              <tr>
              	
              	<td>{{this.class_id}}</td>
              	<td>{{this.class_name}}</td>

              	<!-- html5 data属性存储数据 -->
              	<td calss="data_time" data-time="{{this.class_name}}"></td>
              	<td>
              		
              		<a href="#">编辑</a>
              		<a href="#">删除</a>
              	</td>


              </tr>
              
              {{/each}}

		</thead>


	</table>

	{{include('./common/page.html')}}

</div>

</div>

{{/block}}





<!-- 转换时间格式 -->
<script>
	$(document).ready(function(){
	    var data_time = $(".data_time");

        data_time.each(function(item){
            
            // 用datdaset对象获取 html data 存储的
            var date = timestampToTime(this.dataset.time);

            this.innerHTML = "";
            this.innerHTML = date;
        });

        function timestampToTime(timestamp) {
            var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
            Y = date.getFullYear() + '-';
            M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
            D = date.getDate() + ' ';
            h = date.getHours() + ':';
            m = date.getMinutes();
            return Y+M+D+h+m;
        }
	});
</script>